package nosql.util;

public class Pair<T, E>{
	protected T first;
	protected E second;
	
	protected int cmpIndex;
	
	public Pair(T first, E second) {
		super();
		this.first = first;
		this.second = second;
		cmpIndex = 1;
	}

	public T getFirst() {
		return first;
	}
	
	public void setFirst(T first) {
		this.first = first;
	}
	
	public E getSecond() {
		return second;
	}
	
	public void setSecond(E second) {
		this.second = second;
	}
	
	public void setComparatorIndex(int index){
		cmpIndex = index;
	}
	
	public boolean equals(Object o){
		if(o instanceof Pair<?, ?>){
			Pair<T, E> obj = (Pair<T, E>)o;
			if(this.first.equals(obj) && this.second.equals(obj)){
				System.out.println("Equals." + this.toString() + "," + obj.toString() + "\n\n");
				return true;
			}
			else{
				return false;
			}
		}
		else{
			return false;
		}
	}	
	
	public int hashCode(){
		return first.hashCode() + 128 * second.hashCode();
	}
	
	public String toString(){
		return first.toString() + ":" + second.toString();
	}
	
}
